home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / pmake / lst / RCS / lstInt.h,v < prev    next >
Encoding:
Text File  |  1992-05-19  |  3.0 KB  |  133 lines

  1. head     1.12;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ; strict;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.12
  10. date     92.05.18.17.47.29;  author kupfer;  state Exp;
  11. branches ;
  12. next     1.11;
  13.  
  14. 1.11
  15. date     89.06.13.15.01.46;  author adam;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @@
  22.  
  23.  
  24. 1.12
  25. log
  26. @Don't assume NIL is -1.
  27. @
  28. text
  29. @/*-
  30.  * lstInt.h --
  31.  *    Internals for the list library
  32.  *
  33.  * Copyright (c) 1988 by University of California Regents
  34.  *
  35.  * Permission to use, copy, modify, and distribute this
  36.  * software and its documentation for any purpose and without
  37.  * fee is hereby granted, provided that the above copyright
  38.  * notice appears in all copies.  Neither the University of California nor
  39.  * Adam de Boor makes any representations about the suitability of this
  40.  * software for any purpose.  It is provided "as is" without
  41.  * express or implied warranty.
  42.  *
  43.  * $Id: lstInt.h,v 1.11 89/06/13 15:01:46 adam Exp Locker: kupfer $ SPRITE (Berkeley)
  44.  */
  45. #ifndef _LSTINT_H_
  46. #define _LSTINT_H_
  47.  
  48. #include      <sprite.h>
  49. #include      "lst.h"
  50.  
  51. typedef struct ListNode {
  52.     struct ListNode    *prevPtr;   /* previous element in list */
  53.     struct ListNode    *nextPtr;   /* next in list */
  54.     short            useCount:8, /* Count of functions using the node.
  55.                      * node may not be deleted until count
  56.                      * goes to 0 */
  57.                      flags:8;    /* Node status flags */
  58.     ClientData    datum;        /* datum associated with this element */
  59. } *ListNode;
  60. /*
  61.  * Flags required for synchronization
  62.  */
  63. #define LN_DELETED      0x0001      /* List node should be removed when done */
  64.  
  65. #define NilListNode    ((ListNode)NIL)
  66.  
  67. typedef enum {
  68.     Head, Middle, Tail, Unknown
  69. } Where;
  70.  
  71. typedef struct    {
  72.     ListNode      firstPtr; /* first node in list */
  73.     ListNode      lastPtr;  /* last node in list */
  74.     Boolean          isCirc;      /* true if the list should be considered
  75.                    * circular */
  76. /*
  77.  * fields for sequential access
  78.  */
  79.     Where          atEnd;      /* Where in the list the last access was */
  80.     Boolean          isOpen;      /* true if list has been Lst_Open'ed */
  81.     ListNode      curPtr;      /* current node, if open. NilListNode if
  82.                    * *just* opened */
  83.     ListNode      prevPtr;  /* Previous node, if open. Used by
  84.                    * Lst_Remove */
  85. } *List;
  86.  
  87. #define NilList          ((List)NIL)
  88.  
  89. /*
  90.  * PAlloc (var, ptype) --
  91.  *    Allocate a pointer-typedef structure 'ptype' into the variable 'var'
  92.  */
  93. #define    PAlloc(var,ptype)    var = (ptype) Malloc (sizeof (*var))
  94.  
  95. /*
  96.  * LstValid (l) --
  97.  *    Return TRUE if the list l is valid
  98.  */
  99. #define LstValid(l)    (((Lst)l == NILLST) ? FALSE : TRUE)
  100.  
  101. /*
  102.  * LstNodeValid (ln, l) --
  103.  *    Return TRUE if the LstNode ln is valid with respect to l
  104.  */
  105. #define LstNodeValid(ln, l)    ((((LstNode)ln) == NILLNODE) ? FALSE : TRUE)
  106.  
  107. /*
  108.  * LstIsEmpty (l) --
  109.  *    TRUE if the list l is empty.
  110.  */
  111. #define LstIsEmpty(l)    (((List)l)->firstPtr == NilListNode)
  112.  
  113. #endif _LSTINT_H_
  114. @
  115.  
  116.  
  117. 1.11
  118. log
  119. @checked in with -k by kupfer at 92.05.18.17.32.41.
  120. @
  121. text
  122. @d15 1
  123. a15 1
  124.  * $Id: lstInt.h,v 1.11 89/06/13 15:01:46 adam Exp $ SPRITE (Berkeley)
  125. d20 1
  126. d37 1
  127. a37 1
  128. #define NilListNode    ((ListNode)-1)
  129. d59 1
  130. a59 1
  131. #define NilList          ((List)-1)
  132. @
  133.